package cn.xyf.mzmy.server.config;

import cn.hutool.extra.mail.MailAccount;
import org.bouncycastle.cms.PasswordRecipient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MailAccountConfig {

    @Value("${email.host}")
    private String host;

    @Value("${email.port}")
    private Integer port;

    @Value("${email.sslEnable}")
    private Boolean sslEnable;

    @Value("${email.auth}")
    private Boolean auth;

    @Value("${email.from}")
    private String from;

    @Value("${email.user}")
    private String user;

    @Value("${email.password}")
    private String password;

    @Bean
    public MailAccount mailAccount(){
        MailAccount mailAccount = new MailAccount();
        mailAccount.setHost(host)
                .setPort(port)
                .setSslEnable(sslEnable)
                .setAuth(auth)
                .setFrom(from)
                .setUser(user)
                .setPass(password);
        return mailAccount;
    }


}
